import { createRouter, createWebHashHistory } from "vue-router";
import { message } from "ant-design-vue";
import Login from "../views/login";
import Manager from "../views/manager";
import Point from "../views/config/point";
import Neuron from "../views/config/neuron";
import History from "../views/config/history";
import NeuronDashborad from "../views/running/dashborad-neuron";
import TDengineDashborad from "../views/running/dashborad-tdengine";

const routes = [
  {
    path: "/",
    redirect: "/login",
  },
  { path: "/login", name: "login", component: Login },
  {
    path: "/manager",
    name: "manager",
    component: Manager,
    redirect: "/dashborad-tdengine",
    children: [
      {
        path: "/dashborad-neuron",
        name: "dashborad-neuron",
        component: NeuronDashborad,
        meta: {
          subkey: "sub1",
        },
      },
      {
        path: "/dashborad-tdengine",
        name: "dashborad-tdengine",
        component: TDengineDashborad,
        meta: {
          subkey: "sub1",
        },
      },
      {
        path: "/point",
        name: "point",
        component: Point,
        meta: {
          subkey: "sub2",
        },
      },
      {
        path: "/neuron",
        name: "neuron",
        component: Neuron,
        meta: {
          subkey: "sub2",
        },
      },
      {
        path: "/history",
        name: "history",
        component: History,
        meta: {
          subkey: "sub2",
        },
      },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

// router.beforeEach((to, form, next) => {
//   message.info("hello");
//   next();
// });

export default router;
